package com.trendit.print.sdk.models.soundbox;

import com.alibaba.fastjson.JSON;
import com.trendit.print.sdk.DaquObject;
import com.trendit.print.sdk.DaquRequest;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

public class AddSoundBoxRequest implements DaquRequest<AddSoundBoxResponse> {

    private String bizContent;

    public AddSoundBoxRequest(List<AddSoundBoxRequest.Model> models) {
        this.bizContent = JSON.toJSONString(models);
    }

    @Override
    public String getApiMethodName() {
        return "openapi.addSoundBox";
    }

    @Override
    public String getApiVersion() {
        return "1.0";
    }

    @Override
    public String getNotifyUrl() {
        return null;
    }

    @Override
    public String getApiMethodURL() {
        return "/openapi/speaker/add_device";
    }

    @Override
    public Class<AddSoundBoxResponse> getResponseClass() {
        return AddSoundBoxResponse.class;
    }

    @Override
    public DaquObject getBizModel() {
        return null;
    }

    @Override
    public String getBizContent() {
        return bizContent;
    }

    @Data
    public static class Model extends DaquObject {

        /**
         * 设备编码
         */
        @NotBlank(message = "设备编号不能为空")
        private String sn;

        /**
         * 设备名称
         */
        @Max(value = 50, message = "设备名称长度不能超过${value}个字符")
        private String name;

        /**
         * 设备语言
         */
        @Min(1)
        @Max(16)
        @NotNull
        private Integer lang;

    }

}
